package com.orilife.trade;

import java.util.List;

import com.example.orllife.CoolMakingApplication;
import com.example.orllife.R;
import com.orilife.adapter.ConfirmOrderAdapter;
import com.orilife.bean.Order;

import com.orilife.component.MyListView;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class OrderDetailsActivity extends Activity {
	Button backBt;
	MyListView orderListView;
	TextView statusTv,moneyTv,orderidTv,orderTimeTv,orderReceivertv,phoneTv,addressTv;
	ConfirmOrderAdapter adapter;
	List<Order> orderList;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.orderdetailslayout);
		CoolMakingApplication.getInstance().addActivity(this);
		backBt= (Button)findViewById(R.id.backbt);
		orderListView = (MyListView)findViewById(R.id.orderitemlistview);
		statusTv = (TextView)findViewById(R.id.orderstatustv);
		moneyTv= (TextView)findViewById(R.id.ordermoneytv);
		orderidTv = (TextView)findViewById(R.id.orderidtv);
		orderTimeTv = (TextView)findViewById(R.id.ordertimetv);
		orderReceivertv =  (TextView)findViewById(R.id.orderreceivertv);
		phoneTv = (TextView)findViewById(R.id.orderreceiverphonetv);
		addressTv= (TextView)findViewById(R.id.orderaddresstv);
		backBt.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				OrderDetailsActivity.this.finish();
			}
		});
		
		orderListView.setOnTouchListener(new OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				if(event.getAction()==MotionEvent.ACTION_MOVE)
					return true;
				return false;
			}
		});
		Intent intent = getIntent();
		orderList = intent.getParcelableArrayListExtra("orderlist");
		adapter = new ConfirmOrderAdapter(getApplicationContext());
		adapter.setData(orderList);
		orderListView.setAdapter(adapter);
	
		
	}
	
	@Override
	public void finish() {
		// TODO Auto-generated method stub
		super.finish();
		CoolMakingApplication.getInstance().removeActivity(this);
	}

}
